<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/jsp/common/common_include_for_server.jsp"%>
<script type="text/javascript">
<!--
$(function(){
	reloadImageSliderList();
	loadReports();
	loadArticles();
});
function reloadImageSliderList(){
	$('#imageSliderList').html("Loading...");
	$('#imageSliderList').load('manage/imgslider!imageSliders.action', 1500);
}
function loadReports(pageNum){
	if(!pageNum){
		pageNum = 1;
	}
	$('#reportsTD').html("Loading...");
	var data = {'pageUtil.showPage':pageNum};
	$('#reportsTD').load('manage/imgslider!reports.action', data);
}
function loadArticles(pageNum){
	if(!pageNum){
		pageNum = 1;
	}
	$('#articlesTD').html("Loading...");
	var data = {'pageUtil.showPage':pageNum};
	$('#articlesTD').load('manage/imgslider!articles.action', data);
}
//Article:
function addArticle(articleId){
	$.post('manage/imgslider!save.action',{'imageSlider.article.articleId':articleId}, function(){
		reloadImageSliderList();
	});
}
function removeArticle(articleId){
	$.post('manage/imgslider!delete.action',{'imageSlider.article.articleId':articleId}, function(){
		reloadImageSliderList();
		$('#atc'+articleId).attr('checked', false);
	});	
}
function selectArticle(articleId, checked){
	if(checked){
		addArticle(articleId);
	}else{
		removeArticle(articleId);
	}
}
//Report:
function addReport(reportId){
	$.post('manage/imgslider!save.action',{'imageSlider.report.reportId':reportId}, function(){
		reloadImageSliderList();
	});
}
function removeReport(reportId){
	$.post('manage/imgslider!delete.action',{'imageSlider.report.reportId':reportId}, function(){
		reloadImageSliderList();
		$('#rpt'+reportId).attr('checked', false);
	});	
}
function selectReport(reportId, checked){
	if(checked){
		addReport(reportId);
	}else{
		removeReport(reportId);
	}
}
//-->
</script>
<table border="1" width="850px">
	<tr>
		<td colspan="2" id="imageSliderList"></td>
	</tr>
	<tr>
		<td id="reportsTD" width="50%" valign="top"></td>
		<td id="articlesTD" width="50%" valign="top"></td>
	</tr>
</table>